home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / commodity / stroke / stroke.doc < prev   
Text File  |  1996-12-01  |  14KB  |  394 lines

  1. Stroke Commodity 0.9 (1.12.96)
  2.                     Pasi 'Albert' Ojala
  3.                     albert@cs.tut.fi
  4.                     http://www.cs.tut.fi/~albert/
  5.  
  6.  
  7. What is Stroke Commodity?
  8. ~~~~~~~~~~~~~~~~~~~~~~~~~
  9. Stroke commodity is a mouse-controlled Intuition event generator.
  10. That's a short explanation.  A longer version explains that you
  11. can draw different symbols using the mouse and the commodity will
  12. then interpret them and insert the appropriate events into the
  13. input stream.
  14.  
  15. Strokes are most useful with a 3-button mouse.  You assign the middle
  16. button to be the stroke 'key'.  Press the button down, draw a symbol,
  17. and release the button.  Stroke commodity will then check what you
  18. wanted, creates the corresponding input events and inserts them into
  19. the input event chain.
  20.  
  21.  
  22. Installation
  23. ~~~~~~~~~~~~
  24. Use the accompanied installation script. It installs all files needed
  25. into a directory, and optionally installs a launcher icon into the
  26. WBStartup drawer. Default 4-color icons and MagicWB icons are available.
  27. Start the commodity by double-clicking either the startup-icon or
  28. the installed version. You can then press the default popkey
  29. combination control + left alt + s to open the commodity's window
  30. so that you can configure it to your liking.
  31.  
  32.  
  33. Theory of Operation
  34. ~~~~~~~~~~~~~~~~~~~
  35. When you press the stroke button with the right qualifier key(s)
  36. pressed, the commodity starts to record mouse movements. When you
  37. release the button, a series of operations is performed on the
  38. recorded movements.
  39.  
  40. These movements are relative, i.e. they represent the relative
  41. movement of the mouse. This movement is first filtered with a
  42. median filter to get rid of some noise. Then the movement is
  43. changed from relative to absolute coordinates. Minimum and maximum
  44. values in both directions (horizontal and vertical) are determined.
  45.  
  46. These values represent the rectangular region which contain the
  47. stroke. The stroke is scaled into a 3-by-3 matrix. However, if
  48. the rectangle is more than two times as wide/high as high/wide,
  49. the original aspect ratio is preserved. This makes it possible to
  50. have single horizontal and vertical strokes.
  51.  
  52. If the absolute movement in horizontal or vertical direction is
  53. very small, that movement is discarded. The stroke then has no
  54. movement.
  55.  
  56. When the stroke has been scaled, it is converted back to relative
  57. coordinates for detection. Direction-length -representation is
  58. the logical format, even if it is a bit differently handled in
  59. the program. Anyway, detection is tried next. The new stroke is
  60. compared to existing strokes. Generally it is necessary that
  61. the strokes have the same lines (the same direction and length)
  62. in the same order. The first line and the last line in the stroke
  63. are exceptions, they only need to have the same direction.
  64.  
  65. If a match is found, the corresponding action is performed
  66. (unless "watch only" is selected). If there is no match, and
  67. "learn mode" is activated, the new stroke is added and gets the
  68. currently selected action as a default action. This action can
  69. be later changed or the stroke can be deleted. The stroke is
  70. also shown in the commodity's window. If the window isn't open,
  71. it's opened and the screen is brought to front. If there was no
  72. match and "learn mode" was not activated, nothing happens.
  73.  
  74.  
  75.  
  76.  
  77.  
  78. The Edit Window:
  79. ~~~~~~~~~~~~~~~~
  80. Qualifier Selection:
  81. --------------------
  82. Qualifier
  83. Button
  84.     Here you can select the button and the qualifiers you
  85.     need when making strokes. Middle button is the default.
  86.     When you select qualifier keys and change the button,
  87.     the change will only take place if you use "Apply",
  88.     "Save", or "Use". This also applies to the "Relaxed"
  89.     selection, but does not apply to the stroke and action
  90.     editing and commands.
  91. Exact Match
  92.     Selects exact/relaxed qualifiers. In either mode you
  93.     need to press the selected qualifiers, in relaxed mode
  94.     you can also press additional qualifiers. In exact match
  95.     mode you can only press the selected qualifiers.
  96. Apply
  97.     This gadget updates the current qualifiers, stroke button
  98.     and "relaxed" setting. Is equal to "Use", except that it
  99.     does not close the window. This is not really "Test", like
  100.     in many other preference and commodity programs, because
  101.     "Cancel" does not restore old settings.
  102.  
  103.  
  104. Stroke Controls:
  105. ----------------
  106. Watch Only
  107.     If this box is checked, strokes will not cause any
  108.     input events to be generated. This is useful when you
  109.     are initially teaching a lot of commands and don't want
  110.     them to be 'executed'.
  111. Learn Mode
  112.     When this box is checked, strokes that are not recognized
  113.     are automatically added. The preferred sequence in teaching
  114.     new commands is to first select/set the required action
  115.     (input event description) and then draw the stroke. A new
  116.     stroke is always associated with the action currently selected.
  117.     A new action can be set using the "Bind" gadget.
  118. Stroke <>
  119.     These two small gadgets are used to step through the
  120.     existing strokes. The action display is updated to show
  121.     the action associated with the current showing stroke.
  122. Delete
  123.     This button deletes the current stroke.
  124.  
  125.  
  126. Action Controls:
  127. ----------------
  128. Action <>
  129.     These gadgets are used to select the right action for
  130.     a stroke.
  131. Action String
  132.     Write the action you want here. The action will be updated
  133.     when you press return, so don't forget to press it. This
  134.     changes the action for all strokes that has that action
  135.     "bound" to them.
  136. Bind
  137.     This gadget associates the current action with the
  138.     current stroke. If the current stroke has already
  139.     the current action, this gadget is ghosted.
  140.  
  141.  
  142. Qualifier/Window Controls:
  143. --------------------------
  144. Save
  145.     The selected stroke qualifiers and button will become
  146.     active. Also saves preferences to the icon file, saves
  147.     strokes if they have been changed and closes the window.
  148. Use
  149.     The selected stroke qualifiers and button will become
  150.     active. Also closes the window.
  151. Cancel
  152.     Closes the window without changing the stroke qualifiers
  153.     or the button.
  154.  
  155.  
  156. Menus:
  157. ~~~~~~
  158. Project:
  159. --------
  160. Save Strokes
  161.     Saves current strokes and their actions whether they have
  162.     been changed or not.
  163. Save Prefs
  164.     Saves current preferences whether they have been changed or not.
  165. About
  166.     Opens/closes an about-requester. This is an asynchronous window,
  167.     so you can use strokes while the requester is open.
  168. Hide
  169.     Closes the window but keeps the commodity resident.
  170. Quit
  171.     Quits the commodity. If you try to quit when there are unsaved
  172.     strokes/actions, you are asked if you want to save them.
  173.  
  174.  
  175. Edit
  176. ~~~~
  177. Reset to Defaults
  178.     Initializes the preferences to the default values.
  179. Last Saved
  180.     Reads in the lastly-saved preferences and strokes/actions.
  181. Clear All
  182.     Clears all actions and removes all strokes.
  183.  
  184.  
  185.  
  186.  
  187. Teaching Strokes
  188. ~~~~~~~~~~~~~~~~
  189. Teaching new strokes and actions is best described using an example.
  190. You want to teach a stroke that changes screens.  You have decided
  191. that an up-arrow would be the right stroke.
  192.  
  193. 1)    Start the commodity so that it opens its window.
  194.     (If you have CX_POPUP=NO in the icon, run the program
  195.      again and it will open its window, or use commodity
  196.      exchange to ask the commodity to open its window.)
  197.     You can also open the window by pressing the popkey,
  198.     by default control-left alt-s (<ctrl lalt s>).
  199.  
  200. 2)    Check boxes "Learn Mode" and "Watch Only"
  201.  
  202. 3)    Select a free action, activate the string gadget and
  203.     write "<lcommand m>", not including the quotes.
  204.     (lcommand means the left amiga key, and left amiga+m
  205.      is the screen shuffle combination.)
  206.  
  207. 4)    Remember to press return so that the action is really
  208.     updated.
  209.  
  210. 5)    Press down the required qualifier keys and the stroke
  211.     button (by default no qualifiers, just the middle button)
  212.  
  213. 6)    Move the mouse directly upwards, a moderate amount.
  214.  
  215. 7)    Release the button and/or qualifiers
  216.  
  217. 8)    The stroke you just made should appear. If it didn't,
  218.     you used a wrong qualifier-button combination or didn't
  219.     have the "Learn Mode" active. The first line in the
  220.     stroke is drawn in different color than the rest so that
  221.     it would be easier to see where the stroke starts.
  222.  
  223. 9)    If the stroke doesn't correspond to an up-arrow you draw,
  224.     press "Delete", select the action that has "<lcommand m>"
  225.     and try again. If it did, you can deselect "Learn Mode"
  226.     and "Watch Only" and try out the action you just taught.
  227.  
  228.  
  229. Changing Actions
  230. ~~~~~~~~~~~~~~~~
  231. Many strokes can have the same action. If you want to change
  232. an action you have to options:
  233.  
  234. 1)    Change the action itself - all strokes that had that
  235.     action still has that action, it's just different now.
  236.     Just write a new action text into the string gadget and
  237.     press return.
  238.  
  239. 2)    Select a new action to a stroke - only the current stroke's
  240.     action will be changed. In this case use the "Bind" gadget
  241.     to set the new action to the stroke.
  242.  
  243.  
  244.  
  245. Small List of Events
  246. ~~~~~~~~~~~~~~~~~~~~
  247. smake\n            - "smake" followed by a return
  248. <rcommand q>        - right amiga + q, standard "quit" shortcut
  249. <ctrl lalt help>    - control + left alt + help, default exchange hotkey
  250. <ctrl x>        - control + x, shell delete-line command
  251. <f1>            - the first function key
  252. <rawmouse mouse_leftpress><rawmouse upstroke mouse_leftpress>
  253.             - simulates left mouse button press
  254.  
  255.  
  256. Features & Hints
  257. ~~~~~~~~~~~~~~~~
  258.  
  259. If you select (and "apply" or "use") left or right mouse button
  260. without any qualifiers, the commodity will not filter those button
  261. events. This is because it would become somewhat difficult to change
  262. the settings or use menus. However, if you select middle mouse button
  263. or either of the other buttons with at least one qualifier, button
  264. events with those qualifiers are filtered. Popkey events are also
  265. filtered, they are not seen by other commodities or applications.
  266.  
  267. There were occasional small reversing-effects coming from the mouse.
  268. A median filter was added to remove small mouse glitches.
  269.  
  270. Do not use complex strokes!  The more complex you make your strokes,
  271. the more of them you need to teach to get all the possible combinations
  272. of mouse movements.  With single straight lines you already have eight
  273. strokes, with two straight lines you have 32 more.  These usually need
  274. only one stroke to be recognized correctly, something like O needs 2-4
  275. different strokes.  (O or 0 is a stroke that is actually quite usable.)
  276.  
  277. On the other hand, using only two-line strokes will present a problem
  278. in remembering which stroke does what. Try to pick intuitive strokes.
  279. For example, I assigned amiga-Q to a "bottom-right to top-left" stroke.
  280. A logical extension to this was a stroke "bottom-right, top-left,
  281. bottom-left" bind to amiga-H. Simple up-stroke was intuitive for
  282. screen changing (left amiga M).
  283.  
  284. Preferences are saved into tooltype entries in the icon file. If
  285. there is no icon file when you save preferences, a default tool icon
  286. is created and the settings are saved there. You can change the settings
  287. using e.g. workbench "info" command and then load them using "Last Saved"
  288. in the commodity's edit menu.
  289.  
  290. The strokes and actions are saved into a separate file. By default
  291. the file is "PROGDIR:Stroke.data", which describes a file in the
  292. same directory as the executable. You can change the filename from
  293. the tooltype named "DATAFILE". "Last Saved" will try to read the
  294. datafile, "Save Strokes" writes it.
  295.  
  296. An icon is currently created for the data file. This makes it
  297. easier to move the commodity AND the datafile from one place to
  298. another. For example you can just drag the commodity and the data
  299. file to WBStartup-drawer and be done with it. Oops, I take that
  300. back, seems it's not that simple.
  301.  
  302. Because WB gets confused when you have an icon for the datafile
  303. in the WBStartup directory, I recommend that you install Stroke
  304. into its own directory and just copy a project icon with the
  305. default tool stroke (and whatever the path will be) into the
  306. WBStartup drawer. (The install script does this.) This has two
  307. advantages:
  308. 1) you don't need to copy the catalog files and
  309. 2) everything stroke-related will be kept in the same directory.
  310. So, if you later remove the stroke commodity, it'll be easier.
  311.  
  312. You can't define an action that invokes strokes. You need
  313. to send stroke button press and stroke button release events,
  314. but because of how the commodity works, only the button press
  315. will be received by the commodity when generated by the commodity
  316. itself.
  317.  
  318.  
  319.  
  320.  
  321. Bugs & To do
  322. ~~~~~~~~~~~~
  323. The old popkey remains active even if you select "Reset to Defaults"
  324. or "Last Saved". Live with it or quit and restart stroke commodity
  325. after changing the hotkey.
  326.  
  327. The executable really needs to be named "Stroke". If you always start
  328. the commodity from shell, you can rename it to anything you like, but
  329. then you shouldn't start it from workbench anymore.
  330.  
  331.  
  332.  
  333.  
  334. Greetings go to:
  335.     Henrik Herranen        For talking about the idea so many times.
  336.     Janne Salmijärvi    For mental support..
  337.     Timo Kaikumaa        For testing and suggestions
  338.  
  339.  
  340.  
  341.  
  342. Event generation
  343. ~~~~~~~~~~~~~~~~
  344. Format:    '<' [<type>] [[-]<qualifier>] [<direction>] <keydef> '>'
  345.     or
  346.     <ascii-text>
  347.  
  348.  
  349. Type:
  350.     DISKINSERTED    DISKREMOVED    EVENT        NEWPOINTERPOS
  351.     NEWPREFS    POINTERPOS    RAWKEY        RAWMOUSE
  352.     TIMER
  353.  
  354. Qualifier:
  355.     CAPSLOCK    CAPS_LOCK    CONTROL        CTRL
  356.     LALT        LAMIGA        LBUTTON        LCOMMAND
  357.     LEFTBUTTON    LEFT_ALT    LEFT_AMIGA    LEFT_BUTTON
  358.     LEFT_COMMAND    LEFT_SHIFT    LSHIFT        MBUTTON
  359.     MIDBUTTON    MIDDLEBUTTON    MIDDLE_BUTTON    NUMERICPAD
  360.     NUMERIC_PAD    NUMPAD        NUM_PAD        RALT
  361.     RAMIGA        RBUTTON        RCOMMAND    RELATIVEMOUSE
  362.     REPEAT        RIGHTBUTTON    RIGHT_ALT    RIGHT_AMIGA
  363.     RIGHT_BUTTON    RIGHT_COMMAND    RIGHT_SHIFT    RSHIFT
  364.     ALT        CAPS        SHIFT
  365.  
  366. Key direction:
  367.     UPSTROKE
  368.  
  369. Special keys:
  370.     BACKSPACE    BREAK        COMMA        CURSOR_DOWN
  371.     CURSOR_LEFT    CURSOR_RIGHT    CURSOR_UP    DEL
  372.     DELETE        DOWN        END        ENTER
  373.     ESC        ESCAPE        F1        F10
  374.     F11        F12        F2        F3
  375.     F4        F5        F6        F7
  376.     F8        F9        HELP        HOME
  377.     INSERT        LEFT        PAGE_DOWN    PAGE_UP
  378.     PAUSE        RETURN        RIGHT        SPACE
  379.     SPACEBAR    TAB        UP
  380.  
  381. Rawmouse button events:
  382.     MOUSE_LEFTPRESS
  383.     MOUSE_MIDDLEPRESS
  384.     MOUSE_RIGHTPRESS
  385.  
  386. Keypad keys:
  387.     (        )        *        +
  388.     -        .        /        0
  389.     1        2        3        4
  390.     5        6        7        8
  391.     9        /        .
  392.  
  393.  
  394.